// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables
import 'package:flutter/material.dart';

import 'package:junyeyishu/utils/utils.dart';
import 'package:junyeyishu/widgets/QGWidget.dart';
import 'package:junyeyishu/widgets/QGListState.dart';

class QGDisplaceRecord extends StatefulWidget {
  dynamic id;
  QGDisplaceRecord({super.key, required this.id});
  @override
  State<QGDisplaceRecord> createState() => _QGDisplaceRecordState();
}

class _QGDisplaceRecordState extends QGListState<QGDisplaceRecord> {
  @override
  void initState() {
    super.initState();

    listURL = url_user_getDisassemblelog;
    listKey = "list";

    onRefresh();
  }

  @override
  Map listParam() {
    return {"event_id": widget.id};
  }

  @override
  Widget build(BuildContext context) {
    return QGScaffold(
        title: '分解记录',
        bgColor: Color(0xFFF8F8F6),
        body: Column(children: [SizedBox(height: 10.rpx), buildList()]));
  }

  @override
  itemBuilder(context, index, data) {
    return Container(
      margin: EdgeInsets.only(bottom: 10.rpx, left: 10.rpx, right: 10.rpx),
      padding: EdgeInsets.all(10.rpx),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(6.rpx),
        color: Color(0xFFFFFFFF),
      ),
      child: Row(children: [
        ClipRRect(
          borderRadius: BorderRadius.circular(4.rpx),
          child:
              QGImage(url: data?["thumb_img"], width: 80.rpx, height: 80.rpx),
        ),
        SizedBox(width: 20.rpx),
        Expanded(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                '数量：${data?["new_nft_count"]}',
                style: TextStyle(
                    color: Color(0xFF111111),
                    fontSize: 14.rpx,
                    fontWeight: FontWeight.bold),
              ),
            ],
          ),
        ),
      ]),
    );
  }
}
